<?php
/**
 * @name 过滤配置控制器
 */
namespace app\admin\controller;
use app\common\controller\AdminBase;
class Filter extends AdminBase {
    /**
     * @name 初始化
     */
    protected function _initialize(){
        //添加初始化方法
        $this->mod = model('admin/Config');
        parent::_initialize();
    }
    /**
     * @name 显示页面
     */
    public function index(){
        $this->pageTitle = '直播过滤配置';
        //$type = in_array($this->type,['live','video']) ? $this->type : 'live'; 
        $list = $this->mod->getConfigList('stream_live');
        $this->assign('live_list',$list);
        $list = $this->mod->getConfigList('stream_video');
        $this->assign('video_list',$list);
        return $this->fetch();
    }
    /**
     * @name 添加配置
     */
    public function add(){
        return getApiErrorCode('40423');
        $data = [
            'type' => 'stream_video',
            'value' => [
                'type'  => 'between',
                'key'   => 'time',
                'name'  => 'date',
                'desc'  => '时间',
                'value' => [
                    0 => 'yyyy-MM-dd'
                ]
            ],
            'description' => '开启回放的时间筛选,集成之后将可以使用时间段进行筛选',
            'key'   => 'stream_live_time',
        ];
        return $this->mod->addConfig($data,2);
    }
}